// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.worldMap.styles;

import java.util.ArrayList;
import zombie.core.math.PZMath;
import zombie.worldMap.WorldMapFeature;

public class WorldMapLineStyleLayer extends WorldMapStyleLayer {
    public final ArrayList<WorldMapStyleLayer.ColorStop> m_fill = new ArrayList();
    public final ArrayList<WorldMapStyleLayer.FloatStop> m_lineWidth = new ArrayList();

    public WorldMapLineStyleLayer(String id) {
        super(id);
    }

    @Override
    public String getTypeString() {
        return "Line";
    }

    @Override
    public void render(WorldMapFeature feature, WorldMapStyleLayer.RenderArgs args) {
        WorldMapStyleLayer.RGBAf rGBAf = this.evalColor(args, this.m_fill);
        if (!(rGBAf.a < 0.01F)) {
            float _float;
            if (feature.m_properties.containsKey("width")) {
                _float = PZMath.tryParseFloat((String)feature.m_properties.get("width"), 1.0F) * args.drawer.getWorldScale();
            } else {
                _float = this.evalFloat(args, this.m_lineWidth);
            }

            args.drawer.drawLineString(args, feature, rGBAf, _float);
            WorldMapStyleLayer.RGBAf.s_pool.release(rGBAf);
        }
    }
}
